<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .fade-enter-active,
        .fade-leave-active {
            transition: opacity .5s;
        }

        .fade-enter,
        .fade-leave-to {
            opacity: 0;
        }
    </style>
</head>

<body>
    <div id="app">
        <button @click="show=!show">展示</button>
        <transition name="fade">
            <!-- <p v-if="show">hello</p> -->
            <demo v-if="show"></demo>
        </transition>
    </div>
</body>
<script src="./node_modules/vue/dist/vue.js"></script>
<script>
    Vue.component("demo", {
        template:`<div>😊</div>`
    })
    let vm = new Vue({
        el: "#app",
        data: {
            show: false
        }
    })
</script>

</html>